    function postAjax(url, json, success) {
        $.ajax({
            type : "POST",
            url : url,
            data : JSON.stringify(json),
            dataType : "json",
            contentType : "application/json",
            success : function(data) {
                if (data.code == 0) {
                    success(data);
                } else {
                    alert("服务器异常,请联系开发者");
                }
            },
            error : function(data) {
                alert(url + "请求错误：" + JSON.stringify(data));
            }
        });
    }
function submitForm() {
    $("#errorTips").html("");
    var username = $("#username").val();
    var password = $("#password").val();
    var url = "/xinyue-server-a/account/login";
    var json = {
        "username" : username,
        "password" : password
    };
    postAjax(
        url,
        json,
        function(data) {
            if (data.code == 0) {
                var authUrl = "/xinyue-server-a/account/authen";
                var param = {};
                postAjax(
                    authUrl,
                    param,
                    function(data) {
                        if (data.code == 0) {
                            window.location.href = "/xinyue-server-a/account/main";
                        } else {
                            $("#errorTips").html(data.msg);
                        }
                    });
            } else {
                $("#errorTips").html(data.msg);
            }
        });
}
